<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<div class="modal-dialog ms-modal-dialog" style="margin-top:50px;" >
  <div class="modal-content">
     
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <h4 class="modal-title">评估问卷</h4>
    </div>
      <form class="form-horizontal ms-form form-personal-info" method="POST" action="${ctx.host}/project-results/${projectPhase.id}/${trainee.id}/survey" data-validate="true">
        
        <input type="hidden" name="_method" value="PATCH" /> 

         <div class="modal-body">
            <c:forEach items="${projectPhaseCourses}"  var="projectPhaseCourse" varStatus="pStatus">
	            <div class="form-group  ms-form-group">
		          <label class=" col-xs-8">${projectPhase.project.name}-${projectPhaseCourse.course.name}-${projectPhaseCourse.trainer.name}</label>
	            </div>
            	<c:forEach  items="${courseSurveys }"  var="courseSurvey" varStatus="cStatus">
	             <div class="form-group  ms-form-group">
		          <label class="pull-left col-xs-8 h5">${courseSurvey.question }</label>
		            <div class="col-xs-3 pull-right">
		            	<c:choose>
		            	<c:when test="${courseSurvey.type eq 'select' }">
		            		<c:set var="options" value="${fn:split(courseSurvey.options, ',')}" />
			              <select class="select2 form-control" name="surveyItem" data-validate="required"  >
			                <c:forEach items="${options}" var="option">
			                  <option value="${option}">${option}</option>
			                </c:forEach>
			              </select>
			             </c:when>
		            	<c:when test="${courseSurvey.type eq 'text' }">
			              <textarea class="form-control" name="surveyItem" value="" placeholder=""  autocomplete="off" ></textarea>
			             </c:when>
			             <c:otherwise>
			              <input type="text" class="form-control" name="surveyItem" value="" placeholder="" <c:choose><c:when test="${courseSurvey.type eq 'int' }">data-validate="required|number"</c:when><c:otherwise>data-validate="required"</c:otherwise></c:choose> autocomplete="off" />
			             </c:otherwise>
			             </c:choose>
		            </div>
		           </div>
            	  </c:forEach>
            </c:forEach>
            
        <br>
            	<c:forEach  items="${projectPhaseSurveys }"  var="projectPhaseSurvey" varStatus="ppStatus">
	            <div class="form-group  ms-form-group">
		          <label class="pull-left col-xs-8 h5">${projectPhaseSurvey.question }</label>
		            <div class="col-xs-3 pull-right">
		            	<c:choose>
		            	<c:when test="${projectPhaseSurvey.type eq 'select' }">
		            		<c:set var="options" value="${fn:split(projectPhaseSurvey.options, ',')}" />
			              <select class="select2 form-control" name="surveyItem" data-validate="required"  >
			                <c:forEach items="${options}" var="option">
			                  <option value="${option}">${option}</option>
			                </c:forEach>
			              </select>
			             </c:when>
		            	<c:when test="${projectPhaseSurvey.type eq 'text' }">
			              <textarea class="form-control" name="surveyItem" value="" placeholder=""  autocomplete="off" ></textarea>
			             </c:when>
			             <c:otherwise>
			              <input type="text" class="form-control" name="surveyItem" value="" placeholder="" <c:choose><c:when test="${courseSurvey.type eq 'int' }">data-validate="required|number"</c:when><c:otherwise>data-validate="required"</c:otherwise></c:choose>autocomplete="off" />
			             </c:otherwise>
			             </c:choose>
		            </div>
		           </div>
            	  </c:forEach>        
     


      <div class="modal-footer">
        <button type="submit" class="btn btn-shadow-success btn-shadow umu-btn">确定</button>
        <button type="button" class="btn btn-shadow-default btn-shadow umu-btn" data-dismiss="modal">取消</button>
      </div>
      </form>
    
  </div>
</div>